package com.demo.controller;

import com.demo.common.Result;
import com.demo.pojo.NewUser;
import com.demo.pojo.User;
import com.demo.service.UserService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/user")
@RequiredArgsConstructor
public class LoginController {
    private final UserService userService;


    @GetMapping("/login")
    public Result login(@RequestBody User user) {
        return userService.login(user);
    }

    @PostMapping("/create")
    public Result create(@RequestBody NewUser newUser){
        return userService.createNew(newUser);
    }


}
